package com.zb.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.zb.annotation.NumberLengthPattern;
import com.zb.annotation.NumberPattern;
import com.zb.utils.VerificUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * @Author WEN
 * @Date 2023/10/12 0012
 **/
@Data
@ApiModel("公共字段对象")
public class FieldVo {
    @NotBlank(message = "字段名称不能为空")
    @Length(max = 10, message = "字段名称长度限制 10 个字符")
    @ApiModelProperty(value = "字段名称", required = true)
    private String name;

    @NumberPattern(regexp = VerificUtil.FIELD_TYPE, message = "字段类型参数不合法")
    @ApiModelProperty(value = "字段类型：1-文本，2-多行文本，3-单选，4-多选，5-多图，6-附件，7-视频，8-评分，注：更新修改时，此字段不可更改，必须原样传参", required = true)
    private Integer type;

    @NumberPattern(regexp = "^[1-9]\\d{0,1}|100$", message = "上传大小上限为 100M")
    @NumberLengthPattern(max = 3, message = "上传尺寸长度限制 3 个字符，且上传大小上限为 100M")
    @ApiModelProperty(value = "图片、附件、视频上传尺寸大小，单位：M", example = "100")
    private Integer uploadSize;

    @NumberPattern(regexp = "^[1-9]|10$", message = "上传数量数输入最大值为10")
    @NumberLengthPattern(max = 2, message = "上传数量数输入最大值为10")
    @ApiModelProperty(value = "上传数量，最多可上传10张", example = "10")
    private Integer uploadQty;

    @Length(max = 20, message = "字段提示长度限制 20 个字符")
    @ApiModelProperty(value = "字段提示")
    private String tip;

    @NotNull(message = "是否必填项不能为空")
    @ApiModelProperty(value = "是否必填：false-不必填，true-必填", required = true, example = "true")
    private Boolean required;

    @NotNull(message = "字段状态不能为空")
    @ApiModelProperty(value = "字段状态：false-启用，true-禁用", required = true, example = "false")
    private Boolean status;
}
